<template>
  <h1>人的信息</h1>
  <h2>姓名：{{ person.name }}</h2>
  <h2>年龄：{{ person.age }}</h2>
  <h2>爱好：{{ person.hobby }}</h2>
  <button @click="test">测试触发事件</button>
</template>
  
  <script>
import { reactive } from "vue";
export default {
  name: "App",
  components: {},
  // 接收对象
  props:['msg','school'],
  //   beforeCreate() {
  //     console.log("---beforeCreate---");
  //   },
  emits:['hello'],
  setup(props, context) {
    // 响应式的
    // console.log(props);
    // console.log(context);//attrs slots emit
    // console.log(context.attrs);
    // console.log(context.emit);
    console.log(context.slots);
    // console.log("---setup---", this);
    let person = reactive({
      name: "张三",
      age: 18,
      hobby: ["学习", "吃饭"],
    });
    function test() {
      context.emit("hello", 10);
    }
    return { person, test };
  },
};
</script>
  
  <style>
</style>
  